import request from "@/util/request";//记得引入进来
const baseUrl = 'member/'

/**
 * 注册
 * @param data
 * @returns {*}
 */
export function enrollApi(data) {
    return request({
        method: 'post',
        url: baseUrl + `enroll`,
        data
    })
}

/**
 * 登录
 * @param data 登录数据（用户名，密码）
 * @returns {*}
 */
export function loginApi(data) {
    return request({
        method: 'post',
        url: baseUrl + `login`,
        data
    })
}

/**
 * 获取登录人的信息
 * @returns {*}
 */
export function getMyInfoApi() {
    return request({
        method: 'get',
        url: baseUrl + `get/my/info`,
    })
}

/**
 * 修改个人信息
 * @param data
 * @returns {*}
 */
export function updateByMyselfApi(data) {
    return request({
        method: 'post',
        url: baseUrl + `update/byMyself`,
        data
    })
}

/**
 * 退出登录
 * @returns {*}
 */
export function logoutApi() {
    return request({
        method: 'get',
        url: baseUrl + `logout`,
    })
}

/**
 * 获取邮箱验证码
 * @param email
 * @returns {*}
 */
export function getVerifyEmailCodeApi(email) {
    return request({
        method: 'post',
        url: baseUrl + `get/email/verifyCode`,
        data: {email: email}
    })
}

export function createUserPosts(data){
    return request({
        method:"post",
        url:"user/posts",
        data
    })
}
export function getUserPostsInfo(userPostsId){
    return request({
        method:"get",
        url:"user/posts/info/"+userPostsId,
    })
}
export function getUserPostList(dto){
    return request({
        method:'get',
        url:'user/posts/list',
        params:dto
    })
}
